#ifndef _DBEXECHELPER_H_
#define _DBEXECHELPER_H_

#include "DB/DBExecutor.h"

#define SPECIALBEGIN(StructType)	\
	template <>	\
class TypeHandler<StructType >	\
	{	\
	typedef StructType SpecialType;	\
	public: \
		static void bind(std::size_t pos, SpecialType& data, DBConn* conn) \
		{

#define SPECIALEND() ;\
		} \
	};

#define SPECIALDEF(sz) \
	BIND##sz

#define	BIND1(FT1,FN1)	\
	TypeHandler<FT1>::bind(pos++,data.FN1,conn)

#define BIND2(FT1,FN1,FT2,FN2)	\
	BIND1(FT1,FN1);	\
	BIND1(FT2,FN2)

#define BIND3(FT1,FN1,FT2,FN2,FT3,FN3)	\
	BIND1(FT1,FN1);	\
	BIND2(FT2,FN2,FT3,FN3)

#define BIND4(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4)	\
	BIND1(FT1,FN1);	\
	BIND2(FT2,FN2,FT3,FN3); \
	BIND1(FT4,FN4)

#define BIND5(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5)	\
	BIND1(FT1,FN1);	\
	BIND2(FT2,FN2,FT3,FN3); \
	BIND2(FT4,FN4,FT5,FN5)

#define BIND6(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6)	\
	BIND1(FT1,FN1);	\
	BIND2(FT2,FN2,FT3,FN3); \
	BIND3(FT4,FN4,FT5,FN5,FT6,FN6)

#define BIND7(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7)	\
	BIND1(FT1,FN1);	\
	BIND2(FT2,FN2,FT3,FN3); \
	BIND4(FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7)

#define BIND8(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8)	\
	BIND1(FT1,FN1);	\
	BIND2(FT2,FN2,FT3,FN3); \
	BIND4(FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7); \
	BIND1(FT8,FN8)

#define BIND9(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9)	\
	BIND1(FT1,FN1);	\
	BIND2(FT2,FN2,FT3,FN3); \
	BIND4(FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7); \
	BIND2(FT8,FN8,FT9,FN9)

#define BIND10(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10)	\
	BIND1(FT1,FN1);	\
	BIND2(FT2,FN2,FT3,FN3); \
	BIND4(FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7); \
	BIND3(FT8,FN8,FT9,FN9,FT10,FN10)

#define BIND11(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11)	\
	BIND1(FT1,FN1);	\
	BIND2(FT2,FN2,FT3,FN3); \
	BIND4(FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7); \
	BIND4(FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11)

#define BIND12(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12)	\
	BIND1(FT1,FN1);	\
	BIND2(FT2,FN2,FT3,FN3); \
	BIND4(FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7); \
	BIND5(FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12)

#define BIND13(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13)	\
	BIND1(FT1,FN1);	\
	BIND2(FT2,FN2,FT3,FN3); \
	BIND4(FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7); \
	BIND6(FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13)

#define BIND14(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14)	\
	BIND1(FT1,FN1);	\
	BIND2(FT2,FN2,FT3,FN3); \
	BIND4(FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7); \
	BIND7(FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14)

#define BIND15(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14,FT15,FN15)	\
	BIND1(FT1,FN1);	\
	BIND2(FT2,FN2,FT3,FN3); \
	BIND4(FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7); \
	BIND8(FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14,FT15,FN15)


#define BIND16(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14,FT15,FN15,FT16,FN16)	\
	BIND1(FT1,FN1);	\
	BIND3(FT2,FN2,FT3,FN3,FT4,FN4); \
	BIND4(FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8); \
	BIND8(FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14,FT15,FN15,FT16,FN16)

#define BIND17(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14,FT15,FN15,FT16,FN16,FT17,FN17)	\
	BIND14(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14);	\
	BIND3(FT15,FN15,FT16,FN16,FT17,FN17)

#define BIND18(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14,FT15,FN15,FT16,FN16,FT17,FN17,FT18,FN18)	\
	BIND14(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14);	\
	BIND4(FT15,FN15,FT16,FN16,FT17,FN17,FT18,FN18)

#define BIND19(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14,FT15,FN15,FT16,FN16,FT17,FN17,FT18,FN18,FT19,FN19)	\
	BIND14(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14);	\
	BIND5(FT15,FN15,FT16,FN16,FT17,FN17,FT18,FN18,FT19,FN19)

#define BIND20(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14,FT15,FN15,FT16,FN16,FT17,FN17,FT18,FN18,FT19,FN19,FT20,FN20)	\
	BIND14(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14);	\
	BIND6(FT15,FN15,FT16,FN16,FT17,FN17,FT18,FN18,FT19,FN19,FT20,FN20)

#define BIND21(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14,FT15,FN15,FT16,FN16,FT17,FN17,FT18,FN18,FT19,FN19,FT20,FN20,FT21,FN21)	\
	BIND14(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14);	\
	BIND7(FT15,FN15,FT16,FN16,FT17,FN17,FT18,FN18,FT19,FN19,FT20,FN20,FT21,FN21)

#define BIND22(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14,FT15,FN15,FT16,FN16,FT17,FN17,FT18,FN18,FT19,FN19,FT20,FN20,FT21,FN21,FT22,FN22)	\
	BIND14(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14);	\
	BIND8(FT15,FN15,FT16,FN16,FT17,FN17,FT18,FN18,FT19,FN19,FT20,FN20,FT21,FN21,FT22,FN22)

#define BIND23(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14,FT15,FN15,FT16,FN16,FT17,FN17,FT18,FN18,FT19,FN19,FT20,FN20,FT21,FN21,FT22,FN22,FT23,FN23)	\
	BIND14(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14);	\
	BIND9(FT15,FN15,FT16,FN16,FT17,FN17,FT18,FN18,FT19,FN19,FT20,FN20,FT21,FN21,FT22,FN22,FT23,FN23)

#define BIND24(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14,FT15,FN15,FT16,FN16,FT17,FN17,FT18,FN18,FT19,FN19,FT20,FN20,FT21,FN21,FT22,FN22,FT23,FN23,FT24,FN24)	\
	BIND14(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14);	\
	BIND10(FT15,FN15,FT16,FN16,FT17,FN17,FT18,FN18,FT19,FN19,FT20,FN20,FT21,FN21,FT22,FN22,FT23,FN23,FT24,FN24)

#define BIND25(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14,FT15,FN15,FT16,FN16,FT17,FN17,FT18,FN18,FT19,FN19,FT20,FN20,FT21,FN21,FT22,FN22,FT23,FN23,FT24,FN24,FT25,FN25)	\
	BIND14(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14);	\
	BIND11(FT15,FN15,FT16,FN16,FT17,FN17,FT18,FN18,FT19,FN19,FT20,FN20,FT21,FN21,FT22,FN22,FT23,FN23,FT24,FN24,FT25,FN25)

#define BIND26(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14,FT15,FN15,FT16,FN16,FT17,FN17,FT18,FN18,FT19,FN19,FT20,FN20,FT21,FN21,FT22,FN22,FT23,FN23,FT24,FN24,FT25,FN25,FT26,FN26)	\
	BIND14(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14);	\
	BIND12(FT15,FN15,FT16,FN16,FT17,FN17,FT18,FN18,FT19,FN19,FT20,FN20,FT21,FN21,FT22,FN22,FT23,FN23,FT24,FN24,FT25,FN25,FT26,FN26)

#define BIND27(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14,FT15,FN15,FT16,FN16,FT17,FN17,FT18,FN18,FT19,FN19,FT20,FN20,FT21,FN21,FT22,FN22,FT23,FN23,FT24,FN24,FT25,FN25,FT26,FN26,FT27,FN27)	\
	BIND14(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14);	\
	BIND13(FT15,FN15,FT16,FN16,FT17,FN17,FT18,FN18,FT19,FN19,FT20,FN20,FT21,FN21,FT22,FN22,FT23,FN23,FT24,FN24,FT25,FN25,FT26,FN26,FT27,FN27)

#define BIND28(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14,FT15,FN15,FT16,FN16,FT17,FN17,FT18,FN18,FT19,FN19,FT20,FN20,FT21,FN21,FT22,FN22,FT23,FN23,FT24,FN24,FT25,FN25,FT26,FN26,FT27,FN27,FT28,FN28)	\
	BIND14(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14);	\
	BIND14(FT15,FN15,FT16,FN16,FT17,FN17,FT18,FN18,FT19,FN19,FT20,FN20,FT21,FN21,FT22,FN22,FT23,FN23,FT24,FN24,FT25,FN25,FT26,FN26,FT27,FN27,FT28,FN28)

#define BIND29(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14,FT15,FN15,FT16,FN16,FT17,FN17,FT18,FN18,FT19,FN19,FT20,FN20,FT21,FN21,FT22,FN22,FT23,FN23,FT24,FN24,FT25,FN25,FT26,FN26,FT27,FN27,FT28,FN28,FT29,FN29)	\
	BIND27(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14,FT15,FN15,FT16,FN16,FT17,FN17,FT18,FN18,FT19,FN19,FT20,FN20,FT21,FN21,FT22,FN22,FT23,FN23,FT24,FN24,FT25,FN25,FT26,FN26,FT27,FN27);	\
	BIND2(FT28,FN28,FT29,FN29)

#define BIND30(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14,FT15,FN15,FT16,FN16,FT17,FN17,FT18,FN18,FT19,FN19,FT20,FN20,FT21,FN21,FT22,FN22,FT23,FN23,FT24,FN24,FT25,FN25,FT26,FN26,FT27,FN27,FT28,FN28,FT29,FN29,FT30,FN30)	\
	BIND27(FT1,FN1,FT2,FN2,FT3,FN3,FT4,FN4,FT5,FN5,FT6,FN6,FT7,FN7,FT8,FN8,FT9,FN9,FT10,FN10,FT11,FN11,FT12,FN12,FT13,FN13,FT14,FN14,FT15,FN15,FT16,FN16,FT17,FN17,FT18,FN18,FT19,FN19,FT20,FN20,FT21,FN21,FT22,FN22,FT23,FN23,FT24,FN24,FT25,FN25,FT26,FN26,FT27,FN27);	\
	BIND3(FT28,FN28,FT29,FN29,FT30,FN30)


#endif // _DBEXECHELPER_H_

